<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>数字排序器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 500px;
            margin: 50px auto;
            padding: 20px;
        }
        .container {
            background-color: #f5f5f5;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .input-group {
            margin: 15px 0;
        }
        input {
            width: 200px;
            padding: 8px;
            margin: 5px 0;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        button {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            margin-top: 10px;
        }
        button:hover {
            background-color: #45a049;
        }
        #result {
            margin-top: 20px;
            padding: 15px;
            background-color: #fff;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>数字排序器</h2>
        <div class="input-group">
            <input type="number" id="num1" placeholder="输入第一个数字"><br>
            <input type="number" id="num2" placeholder="输入第二个数字"><br>
            <input type="number" id="num3" placeholder="输入第三个数字">
        </div>
        <button onclick="sortNumbers()">排序</button>
        <div id="result"></div>
    </div>

    <script>
        function sortNumbers() {
            // 获取输入值
            const num1 = parseFloat(document.getElementById('num1').value);
            const num2 = parseFloat(document.getElementById('num2').value);
            const num3 = parseFloat(document.getElementById('num3').value);

            // 验证输入
            if (isNaN(num1) || isNaN(num2) || isNaN(num3)) {
                alert("请输入有效的数字！");
                return;
            }

            // 创建数组并排序
            const numbers = [num1, num2, num3];
            numbers.sort((a, b) => b - a);  // 降序排列

            // 显示结果
            const resultDiv = document.getElementById('result');
            resultDiv.innerHTML = `
                <strong>排序结果：</strong><br>
                从大到小：${numbers.join(" > ")}<br>
                原始数字：${num1}, ${num2}, ${num3}
            `;
        }
    </script>
</body>
</html>